package info.motteke.qjdbc.db;

import java.sql.Connection;

public abstract class ConnectionFactory {
    private final String user;

    private final String password;

    protected ConnectionFactory(){
        this(null, null);
    }

    protected ConnectionFactory(String user, String password){
        this.user = user;
        this.password = password;
    }

    public Connection get(){
        if(user == null || password == null){
            return getConnection();
        }else{
            return getConnection(user, password);
        }
    }
    protected abstract Connection getConnection();

    protected abstract Connection getConnection(String user, String password);
}
